UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p5DLobfNB6joQowV5ZDABPqj6gjTutCcFn5SeGPFFGg='
WHERE
key_id = 'd5664f34678f61bf54967cc732587eb746a4169d0938f284b628b926a3d63118'
AND (
token = 'p5DLobfNB6joQowV5ZDABPqj6gjTutCcFn5SeGPFFGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)