UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WF9lqi7D46zG8f2KBdqKH3WPkLIMr80rT0jASDxOs2w='
WHERE
key_id = '818b75e592af04839aedca05d0b17608b17b99d173e55b2daf667e769a6eaa02'
AND (
token = 'WF9lqi7D46zG8f2KBdqKH3WPkLIMr80rT0jASDxOs2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)