UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T4pzT+krwPRCC4B3Uin2e2j5pOM4LRHFDWn7+oivwgQ='
WHERE
key_id = 'dbc10c4ac793ebcbe9939eb462507fbcbecb49a0c950a1954468e298c494ee5a'
AND (
token = 'T4pzT+krwPRCC4B3Uin2e2j5pOM4LRHFDWn7+oivwgQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)