UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iMxNkBhqVsWmusdYmnNUL/Dux3r0QmD1wMM1HC6Lmv8='
WHERE
key_id = 'c227ed023514bfb8f052dd81cb64b4b2659b88891bff79f2796656c829a8c3a4'
AND (
token = 'iMxNkBhqVsWmusdYmnNUL/Dux3r0QmD1wMM1HC6Lmv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)