UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1d8pCvDIOVaBP1DduLn0eV+u9cI7u4D4ZNmO9+tzbGU='
WHERE
key_id = '99ecfb0d4c077feb0f0e7e3b08894f744e8bd2b9c6b6b7982c8dba242944c93f'
AND (
token = '1d8pCvDIOVaBP1DduLn0eV+u9cI7u4D4ZNmO9+tzbGU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)