UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O2gHh2DvosLMppZr1suL7jqL5Lr82ZNnRbiNbwLc1cY='
WHERE
key_id = 'd7408ac78031006b9c7918ae183dca850384e6f015d8322caa8e870fe6e8561c'
AND (
token = 'O2gHh2DvosLMppZr1suL7jqL5Lr82ZNnRbiNbwLc1cY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)