UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X4e2S4qp9tS4cFAAunJzAfXSTmIX12Gtis2EGAi9JUw='
WHERE
key_id = '4f6eb3826e4398efb83ef9e173bd4b366fe96ee24aae46933fad1011944ebc9c'
AND (
token = 'X4e2S4qp9tS4cFAAunJzAfXSTmIX12Gtis2EGAi9JUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)