UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XI3Pk5rZXQjT871SFoBn0xqyOOnWbH1opeFWahIjD8='
WHERE
key_id = '3d23068dc5ef7a036884ba02893b5a91f9c18ecdd1edf479240f6696712f71cf'
AND (
token = '0XI3Pk5rZXQjT871SFoBn0xqyOOnWbH1opeFWahIjD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)