UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y6WHtpWYP8+qoLSG98b7QfhxAxr/rtwipOuBsaKKJPQ=' 
WHERE 
  key_id = 'f28d54fd6b5e8c045a5abf8f62d673806203b7370d482db06eb6fa0ea18216b8' 
  AND (
    token = 'Y6WHtpWYP8+qoLSG98b7QfhxAxr/rtwipOuBsaKKJPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023