UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SQQd601RAVSDF5yTQgvCFK3n+jWIycJECwsCDL3aAIM=' 
WHERE 
  key_id = '843a4170881e9dd47bfbf25bc9a8dafb099133024e3ea1c7d758b0f1d7ea0160' 
  AND (
    token = 'SQQd601RAVSDF5yTQgvCFK3n+jWIycJECwsCDL3aAIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038