UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kd+Jn50eLl1iJr/U+DNJ/YX0mmSgSzMpwDhF93LJxGM=' 
WHERE 
  key_id = 'd37ae0208d46b24cb2611922a1759432add0577baf14bc3e8b876e489a53503e' 
  AND (
    token = 'kd+Jn50eLl1iJr/U+DNJ/YX0mmSgSzMpwDhF93LJxGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049