UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pEguyKaWuLnbdPL3Y/3BNfslWBWe0rCX0R8eidM008s='
WHERE
key_id = 'b2c47b3955161cd3e91b77987bc590025e8f14de93b79282813a90b34d59f210'
AND (
token = 'pEguyKaWuLnbdPL3Y/3BNfslWBWe0rCX0R8eidM008s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)