UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'htHIM9J5vth4kAcwNury1IsDlgFSsECcBqqEnUwQS9Y=' 
WHERE 
  key_id = '585a9d4739c07f1ca2830c88b5301332171f0b89a8a3df3485de92435c327047' 
  AND (
    token = 'htHIM9J5vth4kAcwNury1IsDlgFSsECcBqqEnUwQS9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027