UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iup99CfT/b5q0N+26ILJsqg2NMpLYo5Jwo70dIOe1+w=' 
WHERE 
  key_id = '6a62e2b3330986c38ab404356158f330aef47e587060550955eb2d72bbca163a' 
  AND (
    token = 'Iup99CfT/b5q0N+26ILJsqg2NMpLYo5Jwo70dIOe1+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076