UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3oProABJXTjZ38fucx4YkIG0MGuPr4AF3OdIMuHudmA=' 
WHERE 
  key_id = 'e50a6629be16aec5a0319a51bd27c6c8e51c461fc455c8471416733d5a0472c3' 
  AND (
    token = '3oProABJXTjZ38fucx4YkIG0MGuPr4AF3OdIMuHudmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062