UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Tk8G8h6hC9hndI9cHZDRicsbD65nIi9NIvboJpgW3E='
WHERE
key_id = '1b5085cce7a70687a3ac827a893a27cdc41cf115713ff2ad3e7e707dace1897b'
AND (
token = '6Tk8G8h6hC9hndI9cHZDRicsbD65nIi9NIvboJpgW3E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)