UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFYdvki21NBblXOuj6vJGvdNmpeafXl5cYCG9SHFS8Q=' 
WHERE 
  key_id = 'f775e810c480752c4f846919292038e2be1c46698df140efe9995dff7e37fb31' 
  AND (
    token = 'CFYdvki21NBblXOuj6vJGvdNmpeafXl5cYCG9SHFS8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039