UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lCFkaGSeKc8sKBwVrynrkDE2sd6yDc6lPP1KWZdvHcI='
WHERE
key_id = '00d17c65aab1180acf458600cc4d967f9e49a331190376ad17924357bb4b2e5a'
AND (
token = 'lCFkaGSeKc8sKBwVrynrkDE2sd6yDc6lPP1KWZdvHcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)