UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBmGhonzjL+bMSoe4gdzLyFlFiHtrOp7lrMgViYt2Tk='
WHERE
key_id = '81b543ea65dd48f6bdcea0d08fb713d738feb45f1322358fd1a42396db99f46a'
AND (
token = 'xBmGhonzjL+bMSoe4gdzLyFlFiHtrOp7lrMgViYt2Tk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)