UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UYNTqlJ9HqQgFtgme+4s6ddCp3VxjYVHVR1ntgwforc=' 
WHERE 
  key_id = '08473852b0444c1ca83ee51c744be183f91d91914043a6b3e6341a1b06cdcd0c' 
  AND (
    token = 'UYNTqlJ9HqQgFtgme+4s6ddCp3VxjYVHVR1ntgwforc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023