UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cfWNaUPVHgd4I1qUGyWJ5mJF0/814FgzxTOa/3djvjg='
WHERE
key_id = 'f9e43ba33083e436cd5d17ab82b1f9344bde586481a66edd1e5e81f942e81360'
AND (
token = 'cfWNaUPVHgd4I1qUGyWJ5mJF0/814FgzxTOa/3djvjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)