UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LHeUZDMuhCYI+yyDWULfIq+RHr6HJT03JDmi/KoWvrA=' 
WHERE 
  key_id = '5acf0fc745db997bae073df01636c8ae796364df42afc5c9a5633c9d536ef35d' 
  AND (
    token = 'LHeUZDMuhCYI+yyDWULfIq+RHr6HJT03JDmi/KoWvrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026