UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wnrxHhAxq8van6W39KE1T0AWQeLwm56IYtOFshVA1Sk='
WHERE
key_id = 'd764219be5e569b0fe1855f85e80c5bf7ea00eca1aea5aafb8c659d382910c9e'
AND (
token = 'wnrxHhAxq8van6W39KE1T0AWQeLwm56IYtOFshVA1Sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)