UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4pyBKzOK+npx6FURsNLzZ8o3rHgIyK8HchOSAquA+Qc='
WHERE
key_id = '7ba237c76c2daf2ef645b5fa5e95e5e69dcf8d308f838f4346d9dee70907a2ae'
AND (
token = '4pyBKzOK+npx6FURsNLzZ8o3rHgIyK8HchOSAquA+Qc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)