UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pTw/uSFXl2ZDdP/W3MZcSxWrIMmsp/CpcxKxB1Ir6Rk='
WHERE
key_id = 'b9b78c292efd8fa9d4deb7b95ca2f6b858b2043741b46648c6574e25ae6567ac'
AND (
token = 'pTw/uSFXl2ZDdP/W3MZcSxWrIMmsp/CpcxKxB1Ir6Rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)