UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3jFpHgUGwA7tkDDtf8zPSdMPv6ryqBTRWW2agLoCOn4='
WHERE
key_id = 'cad080292f524ed014efa35b2d0d32ed524786e3560a3c830968997082e0f6b9'
AND (
token = '3jFpHgUGwA7tkDDtf8zPSdMPv6ryqBTRWW2agLoCOn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)