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