UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tHxEVhaLsivtkPlOD7OOqRfRekHShvp83N/0nSuiWRQ='
WHERE
key_id = '39ad5d2dbc17c2631c3ca526ee0cb587af4554f6e40d24201a9e76942872c8ac'
AND (
token = 'tHxEVhaLsivtkPlOD7OOqRfRekHShvp83N/0nSuiWRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)