UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'esQHUKWdf4Z0GigI8s4yQM/Xh1iHQOIGnZVJhd1eMSg='
WHERE
key_id = 'a28a7ebd930432d0ce24c9e68c36266019c65daa1c19110fdf34a143a39201a4'
AND (
token = 'esQHUKWdf4Z0GigI8s4yQM/Xh1iHQOIGnZVJhd1eMSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)