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