UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n46OiBFZdFxs+8FrqwWHZKfXZ8ttizf3aJKirx2CyBI=' 
WHERE 
  key_id = '083acd5f2bd2b591284078bd4e5d4c3e61c0021a2a6bf9a176e9436b0e1c474d' 
  AND (
    token = 'n46OiBFZdFxs+8FrqwWHZKfXZ8ttizf3aJKirx2CyBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025