UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UanBDM4IOvCT6iHmW3Sx4mZVvjPw1bXK+U9cOHNlT7s='
WHERE
key_id = '9e191ad0a2e7e5c1805a5649320be01c34e98d008fb8e3507435da06c23dc4d8'
AND (
token = 'UanBDM4IOvCT6iHmW3Sx4mZVvjPw1bXK+U9cOHNlT7s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)