UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9dxLZhyc7tYIrg0mtz5lntBONDs5/Vc8O1pA9Ov7YBA='
WHERE
key_id = '2439e177faddd948132d7c74e0871030f5f49fe05be9d5f92664ddc4b51c3674'
AND (
token = '9dxLZhyc7tYIrg0mtz5lntBONDs5/Vc8O1pA9Ov7YBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)