UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QQQFQUXNaWs45ZUM28scZIaEHiF2f3IcuTUyk4rYhM='
WHERE
key_id = 'd5689b585c96381034b001ca36e526de8ae37a25304b5edf0d0d0f9d8a7d8900'
AND (
token = '4QQQFQUXNaWs45ZUM28scZIaEHiF2f3IcuTUyk4rYhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)