UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e98teqeO1W9J5RGkfrdbHP9nGbDMZjwE14kfmw+5XH0='
WHERE
key_id = 'a423dc6c879c2d0e9ddc4e9a8f0dbd9889fe1a0c0687a77e402e0642e38fd3ea'
AND (
token = 'e98teqeO1W9J5RGkfrdbHP9nGbDMZjwE14kfmw+5XH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)