UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GDs9iQpX7dbkppYdEfBvAd/Gg9XGobGNCgTCUScw+HI='
WHERE
key_id = 'b6b2d7bfbc2f46f6faa5efd3ac83972794425894b631ccf8daff46885367c7f2'
AND (
token = 'GDs9iQpX7dbkppYdEfBvAd/Gg9XGobGNCgTCUScw+HI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)