UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PkEk3l9XMYfF5QMrNCBuH84xBkUAihcKJGbes4grTyk=' 
WHERE 
  key_id = '49b74bad169919dc077a397fcb05a76b1df4d292d0c4c204a3cee38ba7fb2881' 
  AND (
    token = 'PkEk3l9XMYfF5QMrNCBuH84xBkUAihcKJGbes4grTyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023