UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LWgXIoikMBnrfbVqRAHXlk0ffQqg5PQmbCcUiqG7zIY='
WHERE
key_id = 'b06e813e542b31abd8219fa50a77b00af1b9119a2b8bad5deb1a43af99e3f7e3'
AND (
token = 'LWgXIoikMBnrfbVqRAHXlk0ffQqg5PQmbCcUiqG7zIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)