UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u3UWPyk/iX6iuzIE6M0vu8ShEIPfRIE3ZbD0JtomtmI=' 
WHERE 
  key_id = '450e12aa9960e741684ff6bbf2a46dbbfc484540c51eb774d089f0333e7bf68c' 
  AND (
    token = 'u3UWPyk/iX6iuzIE6M0vu8ShEIPfRIE3ZbD0JtomtmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027