UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wLLbFgLx8OLmb5l9xAifgFOxB3IWZAlACLm+WD2xEHU='
WHERE
key_id = '56f10030ea5b22ada662ceeea859e208013e3987120c081d045fd43610b8c134'
AND (
token = 'wLLbFgLx8OLmb5l9xAifgFOxB3IWZAlACLm+WD2xEHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)