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