UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6qQn1ujABDq6F6HREjnfq0JveppEjEMGxopfIWITouI=' 
WHERE 
  key_id = 'f26b6f28f3f377241bc57d443a5d30956591f44f35c845275e5aecc163b597ad' 
  AND (
    token = '6qQn1ujABDq6F6HREjnfq0JveppEjEMGxopfIWITouI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052